import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/base/utils/date_util.dart';
import 'package:flutter_ahj_app/base/utils/mTopBar.dart';
import 'package:flutter_ahj_app/base/values/SQColor.dart';
import 'package:flutter_ahj_app/base/values/dimens.dart';

import 'feedSubPage.dart';


///反馈
class FeedbackPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => FeedbackPageState();
}

class FeedbackPageState extends State<FeedbackPage> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: new Scaffold(
        appBar: MTopBar(title: "意见反馈", leftButtonIcon: Icons.close).create(),
        body: _bodyView(),
      ),
    );
  }

  _bodyView() {
    return Card(
      elevation: 0,
      margin: EdgeInsets.all(0),
      color: SQColor.white,
      child: Column(
        children: <Widget>[
          ListTile(
            title: Container(
              child: Row(
                children: <Widget>[
                  Icon(
                    Icons.bug_report,
                    size: Dimens.dimens18,
                  ),
                  Container(
                    width: Dimens.dimens16,
                  ),
                  Text("报告问题"),
                ],
              ),
            ),
            onTap: () => _clickView(0),
          ),
          ListTile(
            title: Container(
              child: Row(
                children: <Widget>[
                  Icon(
                    Icons.edit,
                    size: Dimens.dimens18,
                    //color: SQColor.black_8e8e8e,
                  ),
                  Container(
                    width: Dimens.dimens16,
                  ),
                  Text("提出功能请求",),
                ],
              ),
            ),
            onTap: () => _clickView(1),
          ),
//          ListTile(
//            title: Container(
//              child: Row(
//                children: <Widget>[
//                  Icon(
//                    Icons.email,
//                    size: Dimens.dimens18,
//                    color: SQColor.black_8e8e8e,
//                  ),
//                  Container(
//                    width: Dimens.dimens16,
//                  ),
//                  Text("与支持团队联系",
//                      style: TextStyle(color: SQColor.black_333333)),
//                ],
//              ),
//            ),
//            onTap: () => _clickView(2),
//          ),
//          ListTile(
//            title: Container(
//              child: Row(
//                children: <Widget>[
//                  Icon(
//                    Icons.sms_failed,
//                    size: Dimens.dimens18,
//                    color: SQColor.black_8e8e8e,
//                  ),
//                  Container(
//                    width: Dimens.dimens16,
//                  ),
//                  Text("发送应用反馈", style: TextStyle(color: SQColor.black_333333)),
//                ],
//              ),
//            ),
//            onTap: () => _clickView(3),
//          ),
        ],
      ),
    );
  }

  var _clickTime = 0;

  // 点击菜单
  _clickView(int index) {
    var _curTime = DateUtil.getNowDateMs();
    if (_clickTime != 0 && !(_curTime - _clickTime > 300)) {
      return;
    }
    _clickTime = _curTime;
    switch (index) {
      case 0: //报告问题
      case 1: //提出功能请求
//        Navigator.push(context,
//            new MaterialPageRoute(builder: (context) => FeedSubPage()));
      Navigator.pushNamed(context, "/FeedSubPage");
        break;
      case 2: //与支持团推联系
      case 3: //发送应用反馈
//        Navigator.push(
//            context,
//            MaterialPageRoute(
//                builder: (context) => MineWebView("产品反馈",
//                    "https://jira.xinanli.cn/servicedesk/customer/portal/1")));
        break;
    }
  }
}
